Fix DND keyboard control with XI2
authorMatthias Clasen <mclasen@redhat.com>
Tue, 7 Aug 2012 02:56:59 +0000 (22:56 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 7 Aug 2012 02:56:59 +0000 (22:56 -0400)
We are using XI2 to grab the key events, but we did not do the
necessary extra work to make GDK deliver root window events to us.

https://bugzilla.gnome.org/show_bug.cgi?id=681006

gtk/gtkdnd.c

index 27a615ec43658d8306f3f7c01078b01d595df60a..42f7221ebd7e7b725c62529b5f7fb98533323f55 100644 (file)
@@ -411,6 +411,18 @@ root_key_filter (GdkXEvent *xevent,
   if ((ev->type == KeyPress || ev->type == KeyRelease) &&
       ev->xkey.root == ev->xkey.window)
     ev->xkey.window = (Window)data;
+  else if (ev->type == GenericEvent)
+    {
+      XGenericEventCookie *cookie;
+      XIDeviceEvent *dev;
+
+      cookie = &ev->xcookie;
+      dev = (XIDeviceEvent *) cookie->data;
+
+      if (dev->evtype == XI_KeyPress ||
+          dev->evtype == XI_KeyRelease)
+        dev->event = (Window)data;
+    }
 
   return GDK_FILTER_CONTINUE;
 }